Jes.ext({
	usSess : function(type){
		Jes.sync(function(){Jes.action('usSess',false,function(da){usINFO=da;});});
		if(!usINFO){
			if(type == 1) alert("Session过期，请重新登入！"),parent.Jes.url("../../jesacl/html/login.html");
			else if(type==2) top.Jes.url('login.html'.J(Jes.req()));
			else Jes.url("../pub/error.html");
			return false;
		}else{
			return true;
		}
	}
	,orgTree : {//ajax
		ID : -1
		,init : function(){
			var html = '<ul id="ajax_tree" class="dhtmlgoodies_tree">';//父节点
			Jes.queryO('Aclorg',{lo:0,par:{'id':this.ID}},function(da){
				if(da){
					html += '<li><a href="javascript:void(0);" id="'+da.id+ '" onclick="Jes.orgTree.node(\''+da.id+'\');return false;">'+da.oname+'</a><ul><li parentId="'+da.id+'" class="loading.gif"><a href="javascript:void(0);">Loading...</a></li></ul></li>';
					Jes.html('org_tree',html+'</ul>');
					initTree();//初始化树
					//initContextMenu();//初始化菜单
					//读取第一级
					//loadTreeChildNodes('tree_ul_0','0')
				}
			});
		}
		,queryChildNodes : function(ulId,pId){//treeul_ul_0
			DWRUtil.useLoadingMessage('正在读取数据...');
			var html='';
			Jes.query('aclorgbypid_query_sql@acl',{lo:0,par:{pid:pId}},function(da){
				Jes.each(da,function(i){
					html+='<li><a href="javascript:void(0);" id="'+da[i].id+'" onclick="Jes.orgTree.node(\''+da[i].id+'\',\''+da[i].oname+'\');return false;">'+da[i].oname+'</a>';
					if(da[i].isnext=='1') html+='<ul><li parentId="'+da[i].id+'" class="loading.gif"><a href="javascript:void(0);">Loading</a></li></ul>';
					html+='</li>';
				});
				Jes.html(ulId,html);
				if(html==''){
					Jes(ulId).parentNode.getElementsByTagName('IMG')[0].style.visibility='hidden';
					Jes.hide(ulId);
				}
				parseSubItems(ulId,pId);
			});
		}
		,node : function(id,name){
			if(id==0) return;
			Jes.vals({'oid':id,'oname':name});
		}
	}
});
//读取子节点(固定方法)--ajax树
loadTreeChildNodes=Jes.orgTree.queryChildNodes;

//所有下拉框
Jes.Sel={
	year : function(){
		var yA=[],yy=2012;
		for(var i=0;i<(y-yy+1);i++){
			yA.push({name:(yy+i),id:(yy+i)});
		}
		DWRUtil.addOptions('year',yA,'id','name');
	}
}